﻿<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeBehind="DisplayRevisions.aspx.cs" Inherits="CodeDemon.Views.Builder.CreateReview" %>

<a name="ach"></a>
<p>Select the change sets you want from <a href="#yourchanges">changes you have made</a> or from <a href="#last50">your last 50 commits to SVN</a>.</p>

<p class="showRevisionControl">You can also <a href="#ach" id="showReviewedRevisions">Show Revisions That Are Already In Review</a>.</p>
<p class="hideRevisionControl"><a href="#ach" id="hideReviewedRevisions">Hide Revisions That Are Already In Review</a>.</p>

    <script type="text/javascript">
              
              
              $(document).ready(function() {
                $('#showReviewedRevisions').click(function() {
                    $('.hasReviews').show();
                    $('.hideRevisionControl').show();
                    $('.showRevisionControl').hide();
                });
                
                $('.hideRevisionControl').hide();
                $('.hasReviews').hide();
                $('#hideReviewedRevisions').click(function() {
                    $('.hasReviews').hide();
                    $('.hideRevisionControl').hide();
                    $('.showRevisionControl').show();
                });              
                
                $('#SubButton').click(function() { 
                    
                    if ($('.logID_list:checked').val() == null) {
                        alert('You must select at least one revision to review.');
                        return false;
                    }
                });
                
                $('#SubButton2').click(function() { 
                    
                    if ($('.logID_list:checked').val() == null) {
                        alert('You must select at least one revision to review.');
                        return false;
                    }
                });
              
              });
    </script>


<input type="submit" value="&gt;&gt;&nbsp;Add Selected Revisions And Create Review&nbsp;&gt;&gt;" name="SubmitReview" id="SubButton" />


<% 
    var logEntries = (from logs in ViewData.Model.DAO.GetSVNLogEntriesByDefectNumber(ViewData.Model.CurrentDefectNumber) select logs);
    %>
    <a name="yourchanges">&nbsp;</a>
<h2>Changes Made on <a href="<%= ConfigurationManager.AppSettings["DefectSystem_LookupURL"] %><%= ViewData.Model.CurrentDefectNumber %>" target="_blank"> Defect # <%= ViewData.Model.CurrentDefectNumber%></a></h2>
<%  foreach ( var rev in logEntries ) {
       int i = 0;      
        
        %>                   
            <% if (rev.ReviewCount > 0)
           { %>
            <div class="hasReviews" style="display:none;">
          <% }
           else
           { %>
            <div class="noReviews">
          <% } %>
            <div style="margin-top: 20px;">
            <input class="logID_list" type="checkbox" name="logID_list" value="<%= rev.LogID %>" />
            <span class="revision"><%= rev.Revision %></span>
            &nbsp; created by <%= rev.Author %> &nbsp; on <%= rev.Date %> 
          <% if (rev.ReviewCount > 0) { %>
            <img src="/CodeDemon/Content/infoIcon.gif" title="Caution!" />Already participating in <%= rev.ReviewCount %> Review.
          <% }  %>
            </div>
<div class="logmsg"><%= LinkLogMessage(rev.LogMessage) %></div>
            <a style="margin-left:25px;" id="showFileList<%= rev.LogID %>"><img border="0" src="/CodeDemon/Content/folder_closed.gif" />Display Files</a>
            <a style="display:none;margin-left:25px;" id="hideFileList<%= rev.LogID %>"><img border="0" src="/CodeDemon/Content/folder_open.gif" />Hide Files</a>
            <script type="text/javascript">
                $(document).ready(function() {
                GetRevisionFiles('<%= rev.LogID %>');                    
                });
            </script>
           <ul style="display:none;" id="fileList<%= rev.LogID %>">
           </ul>
        </div>
<% } %>

   <h2>Your Last 50 Changes On Other Defects</h2>
   <a name="last50">&nbsp;</a>
   <input type="submit" value="&gt;&gt;&nbsp;Add Selected Revisions And Create Review&nbsp;&gt;&gt;" name="SubmitReview" id="SubButton2" />
   <p>Return to <a href="#">changes you have made on Defect # <%= ViewData.Model.CurrentDefectNumber%></a>.</p>

   <% 
       var uLogEntries = (from logs in ViewData.Model.DAO.GetSVNLogEntriesByAuthorButNotDefectNumber(ViewData.Model.CurrentDefectNumber, ViewData.Model.CurrentReviewUserSVNAuthor) select logs).Take(50); 
    %>

<%  foreach (var rev in uLogEntries) {
       int i = 0;      
        
        %>                   
        <% if (rev.ReviewCount > 0)
           { %>
            <div class="hasReviews" style="display:none;">
          <% }
           else
           { %>
            <div class="noReviews">
          <% } %>
        
            <div style="margin-top: 20px;">
            <input class="logID_list" type="checkbox" name="logID_list" value="<%= rev.LogID %>" />
            <span class="revision"><%= rev.Revision %> </span>
            &nbsp; created by <%= rev.Author %> &nbsp; on <%= rev.Date %> 
            
          <% if (rev.ReviewCount > 0) { %>
            <img src="/CodeDemon/Content/infoIcon.gif" title="Caution!" />Already participating in <%= rev.ReviewCount %> Review.
          <% }  %>
            
            </div>
<div class="logmsg"><%= LinkLogMessage(rev.LogMessage) %></div>
            
            <a style="margin-left:25px;" id="showFileList<%= rev.LogID %>"><img border="0" src="/CodeDemon/Content/folder_closed.gif" />Display Files</a>
            <a style="display:none;margin-left:25px;margin-bottom:12px;" id="hideFileList<%= rev.LogID %>"><img border="0" src="/CodeDemon/Content/folder_open.gif" />Hide Files</a>
            <script type="text/javascript">
                $(document).ready(function() {
                GetRevisionFiles('<%= rev.LogID %>');                    
                });
            </script>
            
           <ul style="display:none;" id="fileList<%= rev.LogID %>">
           </ul>
       </div>      
    
<% } %>
